package com.cq.hd.order.api.excel;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.cq.hd.common.utils.LocalDateUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

@Getter
public class VerifyRecordSheet implements Serializable {

    @Setter
    @ExcelProperty(value = "子订单号", index = 0)
    @ColumnWidth(30)
    @ApiModelProperty(value = "子订单号")
    private String subOrderNo;

    @Setter
    @ExcelProperty(value = "商品名称", index = 1)
    @ColumnWidth(20)
    @ApiModelProperty(value = "商品名称")
    private String goodsName;

    @ExcelProperty(value = "商品价格", index = 2)
    @ColumnWidth(20)
    @ApiModelProperty(value = "商品价格")
    private String goodsPrice;

    @Setter
    @ExcelProperty(value = "核销商户", index = 3)
    @ColumnWidth(20)
    @ApiModelProperty(value = "核销商户")
    private String merchantShortName;

    @Setter
    @ExcelProperty(value = "下单人昵称", index = 4)
    @ColumnWidth(20)
    @ApiModelProperty(value = "下单人昵称")
    private String nickName;

    @Setter
    @ExcelProperty(value = "下单人手机号", index = 5)
    @ColumnWidth(20)
    @ApiModelProperty(value = "下单人手机号")
    private String mobile;

    @ExcelProperty(value = "核销时间", index = 6)
    @ColumnWidth(24)
    @ApiModelProperty(value = "订单核销时间")
    private String verifyTime;

    public void setGoodsPrice(BigDecimal getGoodsPrice) {
        if (getGoodsPrice != null) {
            this.goodsPrice = getGoodsPrice.setScale(2, BigDecimal.ROUND_HALF_UP).toString();
        }
    }

    public void setVerifyTime(LocalDateTime getVerifyTime) {
        if (getVerifyTime != null) {
            this.verifyTime = LocalDateUtil.toLocalDateTimeToString(getVerifyTime, "yyyy.MM.dd HH:mm:ss");
        }
    }

}
